feat(builtin): rename @nodejs//:npm and @nodejs//:yarn to @nodejs//:[yarn/npm]_node_repositories #1369
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
BREAKING CHANGES:
bazel run @nodejs//:npm
is replaced withbazel run @nodejs//:npm_node_repositories
andbazel run @nodejs//:yarn
is replaced withbazel run @nodejs//:yarn_node_repositories
.@nodejs//:yarn
and@nodejs//:npm
now run yarn & npm in the current working directory instead of on all of thepackage.json
files innode_repositories()
.@nodejs//:bin/node
&@nodejs//:bin/node.cmd
(on Windows) are no longer valid targets. Use@nodejs//:node
instead on all platforms. You can still call the old targets in their platform specific node repositories such as@nodejs_darwin_amd64//:bin/node
.@nodejs//:bin/yarn
&@nodejs//:bin/yarn.cmd
(on Windows) are no longer valid targets. Use@nodejs//:yarn
instead on all platforms. You can still call the old targets in their platform specific node repositories such as@nodejs_darwin_amd64//:bin/yarn
.@nodejs//:bin/npm
&@nodejs//:bin/npm.cmd
(on Windows) are no longer valid targets. Use@nodejs//:npm
instead on all platforms. You can still call the old targets in their platform specific node repositories such as@nodejs_darwin_amd64//:bin/npm
.While working on angular/angular#33927 and cleaning up node_repositories.bzl and in particular the aliases in the @nodejs repository, I came across this change which makes the API surface for the
@nodejs
repository much cleaner and more intuitive.Users can just call
@nodejs//:yarn
on all platforms instead of@nodejs//:bin/yarn
on osx/linux and@nodejs//:bin/yarn.cmd
on Windows. Same difference for npm as well.The targets
@nodejs//:yarn_node_repositories
and@nodejs//:npm_node_repositories
are also better names for those entry points as they run yarn & npm on all of the package.json files in thenode_repositories()
repository rule.Internally, the aliases match up with the actual entry point names so this makes the code much cleaner:
and there is no longer a need to alias the
bin/npm
andbin/npm.cmd
versions of the entry points in@nodejs//:BUILD.bazel
as aliases to the aliases is sufficient:Also,
@nodejs_darwin_amd64//:BUILD.bazel
now looks like this:and
@nodejs//:BUILD.bazel
on OSX now looks like this:Pre-req for angular/angular#33927 so we can call npm & yarn from within an npm_integration_test like so:
PR Checklist
Please check if your PR fulfills the following requirements:
PR Type
What kind of change does this PR introduce?
What is the current behavior?
Issue Number: N/A
What is the new behavior?
Does this PR introduce a breaking change?
Other information